<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
</head>
<body>
<h1>注册</h1>
<form action="javascript:0;">
    <input id="url" th:value="${url}" type="hidden">
    <label>
        <span>NAME</span> <input id="username" name="username" type="text">
    </label>
    <label>
        <span>PASSWORD</span><input id="password" name="password" type="password">
    </label>
    <button>click</button>
</form>
</body>
<script src="https://www.jq22.com/jquery/jquery-3.3.1.js"></script>
<script>
    $("button").click(function () {
        let bean = {
            username: $("#username").val(),
            password: $("#password").val(),
        }
        console.log(bean)
        $.ajax({
            type: 'POST',
            url: "/userRegister/"+$("#url").val(),
            data: bean,
            success: (res) => {
                if (res.code === 200){
                    window.location.href="/loginPage/"+res.url
                }else {
                    alert(res.msg)
                }
            }
        })
    });
</script>
</html>